package sdau.hjk.util;

import org.apache.commons.codec.binary.Base64;
import org.junit.Test;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Scanner;

/**
 *@version 1.0
 *@author: huangjiakai
 *@create:2021−04-23 17:35
 *@className:sdau.hjk.util.EncryptionUtils
 *@description: TODO
 */
public class EncryptionUtils {
    public static String md5(String msg) {
        try {
            MessageDigest md=MessageDigest.getInstance("MD5");
            byte[] in=msg.getBytes();
            byte[] out=md.digest(in);
            String message= Base64.encodeBase64String(out);
            return message;
        }catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
